<%@ include file="/taglibs.jsp"%>
<s:url action="exportReceipt" var="exportReceiptURL">
	<s:param name="id" value="%{file.id}"></s:param>
</s:url>

<s:url action="editFile" var="editFileURL">
	<s:param name="id" value="%{file.id}"></s:param>
</s:url>

<s:url action="delete_file" var="deleteFileURL">
	<s:param name="id" value="%{file.id}"></s:param>
</s:url>

<s:url action="transferFile" var="transferFileURL">
	<s:param name="id" value="%{file.id}"></s:param>
</s:url>
			
<s:url action="default" namespace="/" var="backToFileListURL"/>
<fieldset>
    <legend><s:text name="file.group.category"></s:text>:</legend>
    <div class="container_2">
		<table>
			<tr>
				<td width="150px" ><strong><s:text	name="file.field" />:</strong></td>
				<td ><s:property value="file.category.field.name"/></td>
			</tr>
			<tr>
				<td width="150px"><strong><s:text	name="file.category" />:</strong></td>
				<td ><s:property value="file.category.categoryName"/></td>
			</tr>
			<tr>
				<td width="150px"><strong><s:text	name="file.subCategory" />:</strong></td>
				<td ><s:property value="file.subCategory.name"/></td>
			</tr>
		</table>
    </div>
</fieldset>


<fieldset>
    <legend><s:text name="file.detail.title2"></s:text>:</legend>
    <div class="container_2">
    	<table>
			<tr>
				<td width="150px" ><strong><s:text	name="file.number" />:</strong></td>
				<td width="200px" ><s:property value="file.number"/></td>
				<td width="150px" ><strong><s:text	name="file.id" />:</strong></td>
				<td ><s:property value="file.id"/></td>
			</tr>
			<tr>
				<td><strong><s:text	name="file.sender" />:</strong></td>
				<td><s:property value="file.sender"/></td>
				<td><strong><s:text	name="file.senderPhone" />:</strong></td>
				<td ><s:property value="file.senderPhone"/></td>
			</tr>
			<tr>
				<td><strong><s:text	name="file.contactName" />:</strong></td>
				<td colspan="3"><s:property value="file.contactName"/></td>
			</tr>
			<tr>
				<td><strong><s:text	name="file.contactPhone" />:</strong></td>
				<td ><s:property value="file.contactPhone"/></td>
				<td><strong><s:text	name="file.contactFax" />:</strong></td>
				<td><s:property value="file.contactFax"/></td>
			</tr>
			<tr>
				<td><strong><s:text	name="file.submitter" />:</strong></td>
				<td ><s:property value="file.submitter"/></td>
				<td><strong><s:text	name="file.address" />:</strong></td>
				<td><s:property value="file.address"/></td>
			</tr>
			
		</table>
    </div>
</fieldset>

<fieldset>
    <legend><s:text name="file.group.building.info"></s:text>:</legend>
    <div class="container_2">
    	<table>
			<tr>
				<td width="150px" ><strong><s:text	name="file.construct" />:</strong></td>
				<td width="200px" ><s:property value="file.construct"/></td>
				<td width="150px" ><strong><s:text	name="file.location" />:</strong></td>
				<td ><s:property value="file.location"/></td>
			</tr>
		</table>
	</div>
</fieldset>	

<fieldset>
    <legend><s:text name="file.consultant.title"></s:text>:</legend>
    <div class="container_2">
    	<table>
			<tr>
				<td width="150px" ><strong><s:text	name="file.consultantName" />:</strong></td>
				<td colspan="3" ><s:property value="file.consultantName"/></td>
			</tr>
			<tr>
				<td width="150px" ><strong><s:text	name="file.consultantPhone" />:</strong></td>
				<td width="200px" ><s:property value="file.consultantPhone"/></td>
				<td width="150px" ><strong><s:text	name="file.consultantAdd" />:</strong></td>
				<td ><s:property value="file.consultantAdd"/></td>
			</tr>
		</table>
	</div>
</fieldset>	
		
<fieldset>
    <legend><s:text name="file.fileStatus.items_name"></s:text>:</legend>
    <div class="container_2">
    	<table>
			<tr>
				<td width="150px" ><strong><s:text	name="file.detail.title5" />:</strong></td>
				<td width="200px" ><s:property value="file.fileStatus.status"/></td>
				<td width="150px" ><strong><s:text	name="file.createdBy" />:</strong></td>
				<td ><s:property value="file.createdBy.fullname"/></td>
			</tr>
			<tr>
				<td><strong><s:text	name="file.inputDate" />:</strong></td>
				<td ><s:set var="inputDate" value="file.inputDate" scope="request"></s:set><joda:format value="${inputDate}" pattern="${datePattern}" /></td>
				<td><strong><s:text	name="file.outputDate" />:</strong></td>
				<td><s:set var="outputDate" value="file.outputDate" scope="request"></s:set><joda:format value="${outputDate}" pattern="${datePattern}" /></td>
			</tr>
		</table>
    </div>
</fieldset>


<fieldset>
    <legend><s:text name="file.organization.title"></s:text>:</legend>
    <div class="container_2">
    	<table>
			<tr>
				<td width="150px" ><strong><s:text	name="file.organization" />:</strong></td>
				<td colspan="3"><s:property value="file.organization"/></td>
			</tr>
			<tr>
				<td width="150px" ><strong><s:text	name="file.orgPhone" />:</strong></td>
				<td width="200px" ><s:property value="file.orgPhone"/></td>
				<td width="150px" ><strong><s:text	name="file.orgFax" />:</strong></td>
				<td ><s:property value="file.orgFax"/></td>
			</tr>
		</table>
    </div>
</fieldset>

<fieldset>
    <legend><s:text name="file.oversea.title"></s:text>:</legend>
    <div class="container_2">
    	<table>
			<tr>
				<td width="150px" ><strong><s:text	name="file.oversea" />:</strong></td>
				<td colspan="3"><s:property value="file.oversea"/></td>
			</tr>
			<tr>
				<td width="150px" ><strong><s:text	name="file.overseaPhone" />:</strong></td>
				<td width="200px" ><s:property value="file.overseaPhone"/></td>
				<td width="150px" ><strong><s:text	name="file.overseaFax" />:</strong></td>
				<td ><s:property value="file.overseaFax"/></td>
			</tr>
		</table>
    	
    </div>
</fieldset>


<fieldset>
    <legend><s:text name="file.detail.title4"></s:text>:</legend>
    <%-- <s:set name="attachFileDetails" value="file.attachFileDetails" scope="request"/> --%>
    <s:set name="attachFileDetails" value="listAttachByFile" scope="request"/>
    
    <display:table name="attachFileDetails" class="table" id="attachFileDetail" partialList="false">
	    <display:column property="attachFile.attachFileName" titleKey="attachFile.attachFileName" escapeXml="true"/>
	    <display:column property="numberOfcopy" titleKey="attachFile.detail.numberOfCopy" escapeXml="true"/>
	    <display:column property="documentType.name" titleKey="attachFile.detail.documentType">
	    </display:column>
	</display:table>
	
	<!-- table here -->
	<div class="container_2">
    	<div class="grid_2"><p><s:text name="file.otherAttachFiles"></s:text>: </p></div>
    	<div class="grid_1"><p><s:property value="file.otherAttachFiles"/>&nbsp;</p></div>
    	<div class="clear">&nbsp;</div>
    </div>
</fieldset>
	

<table>
	<tr>
	    <td>&nbsp;</td>
	    <td>
		    <c:if test="${not empty param.id}">
		    	<%-- <s:if test="file.fileStatus.id == 1"> --%>
		    		<s:a href="%{deleteFileURL}" onclick="return confirm('B\u1EA1n c\u00F3 ch\u1EAFc mu\u1ED1n x\u00F3a H\u1ED3 s\u01A1 n\u00E0y kh\u00F4ng? (Ok/Cancel)');">
			    		<img src="${ctx}/images/btn_delete_link.png">
			    	</s:a>
		        <%-- </s:if> --%>
		    	<s:if test="file.fileStatus.id == 1 || file.fileStatus.id == 3">
			        <s:a href="%{editFileURL}" >
			    		<img src="${ctx}/images/btn_edit_link.png">
			    	</s:a>
		    	</s:if>
		    </c:if>
	    	<s:a href="%{backToFileListURL}" >
	    		<img src="${ctx}/images/btn_cancel_link.png">
	    	</s:a>
	        <!-- BEGIN PRINT -->
	        <c:if test="${file.category.report == null}">
	        	<a href="<s:property value="%{exportReceiptURL}"/>" target="_blank" class="button">
	        		<s:property value="getText('file.print')"/>
	        	</a>
	        </c:if>
	        <c:if test="${file.category.report != null}">
	        	<%-- <s:url action="%{'exportDocFile!'+file.category.report.functionName}" var="exportVoucherURL"> --%>
	        	<s:url action="%{'exportDocFile!exportReceiptFile.html'}" var="exportVoucherURL">
					<s:param name="id" value="%{file.id}"></s:param>
				</s:url>
				<c:if test="${not empty param.id}">
					<s:a href="%{exportVoucherURL}">
						<img src="${ctx}/images/export_word.png">
					</s:a>
				</c:if>
	        </c:if>
			
			
			<!-- END PRINT -->
	    </td>
	</tr>
</table>